package com.mengya.service;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.mengya.bean.Person;

public class PersonService {
	public List<Person> getAllPerson() {   
		Person p=null;
		List<Person> perList = new ArrayList<Person>();
		
		perList.add(new Person("Lily", "female", String.valueOf(22), "湖北", "10086"));  
		perList.add(new Person("Macro", "male", String.valueOf(33), "北京", "13800000000"));  
		perList.add(new Person("Andy", "male", String.valueOf(44), "香港", "13812345678"));  
		perList.add(new Person("Linder", "female", String.valueOf(28), "大连", "18677778888"));  
		perList.add(new Person("Jessie", "female", String.valueOf(26), "Gansu", "18219177720"));  
		
		perList.add(new Person("Lily", "female", String.valueOf(22), "湖北", "10086"));  
		perList.add(new Person("Macro", "male", String.valueOf(33), "北京", "13800000000"));  
		perList.add(new Person("Andy", "male", String.valueOf(44), "香港", "13812345678"));  
		perList.add(new Person("Linder", "female", String.valueOf(28), "大连", "18677778888"));  
		perList.add(new Person("Jessie", "female", String.valueOf(26), "Gansu", "18219177720"));  
		
		perList.add(new Person("Lily", "female", String.valueOf(22), "湖北", "10086"));  
		perList.add(new Person("Macro", "male", String.valueOf(33), "北京", "13800000000"));  
		perList.add(new Person("Andy", "male", String.valueOf(44), "香港", "13812345678"));  
		perList.add(new Person("Linder", "female", String.valueOf(28), "大连", "18677778888"));  
		perList.add(new Person("Jessie", "female", String.valueOf(26), "Gansu", "18219177720"));  
		
		perList.add(new Person("Lily", "female", String.valueOf(22), "湖北", "10086"));  
		perList.add(new Person("Macro", "male", String.valueOf(33), "北京", "13800000000"));  
		perList.add(new Person("Andy", "male", String.valueOf(44), "香港", "13812345678"));  
		perList.add(new Person("Linder", "female", String.valueOf(28), "大连", "18677778888"));  
		perList.add(new Person("Jessie", "female", String.valueOf(26), "Gansu", "18219177720"));  
		
		perList.add(new Person("Lily", "female", String.valueOf(22), "湖北", "10086"));  
		perList.add(new Person("Macro", "male", String.valueOf(33), "北京", "13800000000"));  
		perList.add(new Person("Andy", "male", String.valueOf(44), "香港", "13812345678"));  
		perList.add(new Person("Linder", "female", String.valueOf(28), "大连", "18677778888"));  
		perList.add(new Person("Jessie", "female", String.valueOf(26), "Gansu", "18219177720"));  
		
		perList.add(new Person("Lily", "female", String.valueOf(22), "湖北", "10086"));  
		perList.add(new Person("Macro", "male", String.valueOf(33), "北京", "13800000000"));  
		perList.add(new Person("Andy", "male", String.valueOf(44), "香港", "13812345678"));  
		perList.add(new Person("Linder", "female", String.valueOf(28), "大连", "18677778888"));  
		perList.add(new Person("Jessie", "female", String.valueOf(26), "Gansu", "18219177720"));  
		
		perList.add(new Person("Lily", "female", String.valueOf(22), "湖北", "10086"));  
		perList.add(new Person("Macro", "male", String.valueOf(33), "北京", "13800000000"));  
		perList.add(new Person("Andy", "male", String.valueOf(44), "香港", "13812345678"));  
		perList.add(new Person("Linder", "female", String.valueOf(28), "大连", "18677778888"));  
		perList.add(new Person("Jessie", "female", String.valueOf(26), "Gansu", "18219177720"));  
		
		perList.add(new Person("Lily", "female", String.valueOf(22), "湖北", "10086"));  
		perList.add(new Person("Macro", "male", String.valueOf(33), "北京", "13800000000"));  
		perList.add(new Person("Andy", "male", String.valueOf(44), "香港", "13812345678"));  
		perList.add(new Person("Linder", "female", String.valueOf(28), "大连", "18677778888"));  
		perList.add(new Person("Jessie", "female", String.valueOf(26), "Gansu", "18219177720"));  
		
		perList.add(new Person("Lily", "female", String.valueOf(22), "湖北", "10086"));  
		perList.add(new Person("Macro", "male", String.valueOf(33), "北京", "13800000000"));  
		perList.add(new Person("Andy", "male", String.valueOf(44), "香港", "13812345678"));  
		perList.add(new Person("Linder", "female", String.valueOf(28), "大连", "18677778888"));  
		perList.add(new Person("Jessie", "female", String.valueOf(26), "Gansu", "18219177720"));  
		
		perList.add(new Person("Lily", "female", String.valueOf(22), "湖北", "10086"));  
		perList.add(new Person("Macro", "male", String.valueOf(33), "北京", "13800000000"));  
		perList.add(new Person("Andy", "male", String.valueOf(44), "香港", "13812345678"));  
		perList.add(new Person("Linder", "female", String.valueOf(28), "大连", "18677778888"));  
		perList.add(new Person("Jessie", "female", String.valueOf(26), "Gansu", "18219177720"));  
		
		perList.add(new Person("Lily", "female", String.valueOf(22), "湖北", "10086"));  
		perList.add(new Person("Macro", "male", String.valueOf(33), "北京", "13800000000"));  
		perList.add(new Person("Andy", "male", String.valueOf(44), "香港", "13812345678"));  
		perList.add(new Person("Linder", "female", String.valueOf(28), "大连", "18677778888"));  
		perList.add(new Person("Jessie", "female", String.valueOf(26), "Gansu", "18219177720"));  
		
//    	try {
//			Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
//			Connection conn=DriverManager.getConnection("jdbc:microsoft:sqlserver://DEPSER;DatabaseName=SFHRMIS", "sa", "sa");
//			String sql="select IndexID as id,UserName as name,GroupID as age,UserNo as address from UserInfo";
//			PreparedStatement ps=conn.prepareStatement(sql);
//			ResultSet rs=ps.executeQuery();
//			while(rs.next()){
//				p=new Person();
//				p.setPerson_Id(rs.getString("id"));
//				p.setPerson_name(rs.getString("name"));
//				p.setPerson_age(rs.getString("age"));
//				p.setPerson_address(rs.getString("address"));
//				perList.add(p);
//			}
//		} catch (ClassNotFoundException e) {
//			e.printStackTrace();
//		} catch (SQLException e) {
//			e.printStackTrace();
//		}
		return perList;
    }   
}

